import { kgjHttp as http } from '@/services/http';
import type { SortAndLimit } from '@/types/api/common';

/** 商品解析 */
export const investCalendarUrlParse = (params: { product_url: string }) => {
  return http({
    method: 'post',
    url: '/api/invest/calendar/url/parse',
    params
  });
};

/** 创建或编辑推荐品类 */
export const investCalendarUpsert = (data: any) => {
  return http({
    method: 'post',
    url: '/api/invest/calendar/upsert',
    data
  });
};

/** 推荐商品列表 */
export const investCalendarList = (payload: { data: any; params: SortAndLimit }) => {
  return http({
    method: 'post',
    url: '/api/invest/calendar/list',
    ...payload
  });
};

/** 导入品类 */
export const investCalendarImport = (data: any) => {
  return http({
    method: 'post',
    url: '/api/invest/calendar/import',
    contentType: 'multipart/form-data',
    data
  });
};

/** 删除品类 */
export const investCalendarDelete = (params: { id: any}) => {
  return http({
    method: 'post',
    url: '/api/invest/calendar/delete',
    params
  });
};

/** 获取品类详情 */
export const investCalendarDetail = (params: { id: any}) => {
  return http({
    method: 'get',
    url: '/api/invest/calendar/detail',
    params
  });
};

